Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build qualifier from server's Version #35172

Merged
merged 25 commits into from
Nov 7, 2018

Conversation

alpar-t
Copy link
Contributor

@alpar-t alpar-t commented Nov 1, 2018

Build on #35155 ( and contains commits from )

  • Rename the constant with an automated IDE refactoring - this generates a high number of changes and changed files.
  • Pass only the numeric part of the version in places like plugin properties so the server doesn't have to deal with qualifier and snapshot.
  • adds a new substitution to doc tests as the docs now need to know about both.
  • adds a new String version field to Build to hold the complete version string passed on from the build.
  • replace Version.getDisplayVersion with Build.CURRENT.getVersion() introduced above
  • add a new build_version parameter to version. Was not sure this is the way to go, feedback is welcome. The alternative is to have version.number show the build qualifier as well without adding a new build_version. It did use to have -SNAPSHOT in there, but it's not technically a "number". Not that the content of version.number will change in regardless.

With this change elasticsearch greets as:

{
  "name" : "node-0",
  "cluster_name" : "distribution_run",
  "cluster_uuid" : "qvtY3T1bQi-vR4zO4lrpyQ",
  "version" : {
    "number" : "7.0.0",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "26be21b",
    "build_date" : "2018-11-05T13:40:03.172633Z",
    "build_snapshot" : true,
    "build_version" : "7.0.0-alpha1-SNAPSHOT",
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.6.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

And in the logs we have:

 version [7.0.0-alpha1-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production

@alpar-t alpar-t added >non-issue :Delivery/Build Build or test infrastructure v7.0.0 labels Nov 1, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@alpar-t alpar-t added the WIP label Nov 1, 2018
@alpar-t alpar-t force-pushed the remove-build-qualifier-server branch from 3b7cd6a to 8bda2da Compare November 1, 2018 17:35
@alpar-t alpar-t force-pushed the remove-build-qualifier-server branch from dbd1bcf to d0c3224 Compare November 1, 2018 19:50
@alpar-t alpar-t force-pushed the remove-build-qualifier-server branch from 844de2f to fa5d007 Compare November 2, 2018 04:12
@alpar-t alpar-t removed the WIP label Nov 4, 2018
Now that the version no longer carries information about the qualifier,
we still need a way to show the "display version" that does have both
qualifier and snapshot.
With this change we read it from the jar.
A subsequent change will switch to useing it instead of
`Version.displayVersion`
@nik9000 nik9000 self-requested a review November 5, 2018 17:27
Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! I left a few small things. I like Build.getVersion() - though maybe not the name? Maybe Build.getQualifiedVersion or something. And it should have javadoc. Because we already have Version and it isn't the same thing.

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 6, 2018

Thanks for your review @nik9000 . I made changes as suggested.

@@ -24,6 +24,7 @@ which should give you a response something like this:
"build_hash" : "f27399d",
"build_date" : "2016-03-30T09:51:41.449Z",
"build_snapshot" : false,
"build_version" : "{qualified_version}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the key here be qualified?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I don't think build_version is right though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nik9000
I'm not entirely sure qualified will make things easier to understand either.
Maybe just have this returned as number ? Users will run production releases most of the time, and they'll just see the same information twice if we have a new field.
I will deal with this in a new PR.

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few super minor things but this LGTM. Good luck on the backport!

Build.CURRENT.isSnapshot() ? "-SNAPSHOT" : "");
Locale.ROOT,
"%s/employees/1",
System.getProperty("tests.jboss.home")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "home" means something else in this context. Maybe test.wildfly.root?

}
}

public String getQualifiedVersion() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add javadoc to this?

@@ -235,9 +264,13 @@ public boolean isSnapshot() {
return isSnapshot;
}

public boolean isProductionRelease() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too?

@@ -102,7 +101,7 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
final String versionOutput = String.format(
Locale.ROOT,
"Version: %s, Build: %s/%s/%s/%s, JVM: %s",
Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot()),
Build.CURRENT.getQualifiedVersion(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the indentation on this one is off.

static void warnIfPreRelease(final Version version, final boolean isSnapshot, final Logger logger) {
if (!version.isRelease() || isSnapshot) {
static void warnIfPreRelease(final Build build,final Logger logger) {
if (build.isProductionRelease() == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe this isn't worth being its own method any more. Now that we're testing isProductionRelease instead.

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 7, 2018

@nik9000 this is not planned to be back-ported. I have done so with the work leading up here, but don't plan to do it with this one. Do you think we should ?

@alpar-t alpar-t merged commit 8a85b2e into elastic:master Nov 7, 2018
@alpar-t alpar-t deleted the remove-build-qualifier-server branch November 7, 2018 12:01
@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 7, 2018

After looking more into it, it seems that it was a deliberate decision not to have -SNAPSHOT in version.number so we'll probably want to stick to that.

pgomulka pushed a commit to pgomulka/elasticsearch that referenced this pull request Nov 13, 2018
With this change, `Version` no longer carries information about the qualifier,
we still need a way to show the "display version" that does have both
qualifier and snapshot. This is now stored  by the build and red from `META-INF`.
@javanna
Copy link
Member

javanna commented Nov 22, 2018

I noticed that when you run ./gradlew assemble the generated artifacts no longer contain the build qualifier, e.g. elasticsearch-7.0.0-SNAPSHOT.zip rather than elasticsearch-7.0.0-alpha1-SNAPSHOT.zip. Not sure if this was done on purpose, just double checking.

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 23, 2018

@javanna that was done on purpose. Qualified builds will be tagged as such as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants